<!DOCTYPE html>
<html lang="zh-CN">
    <head>
        <title>${metadata.alias!}</title>
        <@tools.includePlace path="/common/8ddab9ba-a8aa-4745-86c6-66bf1c2c976c.html"/> <#-- header -->
    </head>
    <body>
        <@tools.includePlace path="/common/c32a4f4a-ff5d-49cf-bb59-5d9784539174.html"/> <#-- 导航 -->

        <div class="container">
            <div class="row gx-5 justify-content-between my-5">
                <@tools.includePlace path="/c936c718-5f19-426f-b3ff-13a5a8d63044.html"/> <#-- 个人中心导航 -->
                <div class="col-md-9">
                    <div class="ps-4">
                        <h3>请先加好本站链接</h3>
                        <#assign path='/cfdc226d-8abc-48ec-810d-f3941b175b20.html'/>
                        <@import path="ftl/tools.ftl" namespace="t"/>
                        <#if error?has_content>
                            <p style="color:red"><@t.m error/></p>
                        </#if>
                        <#if result?has_content&&!error?has_content>
                            <p style="color:red">提交成功，请等待管理员审核！</p>
                        <#else>
                            <form method="post" action="${site.dynamicPath}place/save" onsubmit="return check();">
                                <input name="path" type="hidden" value="${path}" />
								<input type="hidden" name="_csrf" value="<@tools.csrfToken/>"/>
                                <input name="returnUrl" type="hidden" value="${site.dynamicPath}member/friendlink.html?result=true" />
                                <p><label class="input-label">友链标题:</label><input name="title" type="text" size="60" maxlength="60" value=""/></p>
                                <p><label class="input-label">网站地址:</label><input name="url" type="text" size="60"  maxlength="60" value=""/></p>
                                <p><input class="btn btn-primary" type="submit" value="提交"/></p>
                            </form>
                        </#if>

                        <@tools.placeMetadata path=path><#assign a=object/></@tools.placeMetadata>
                        <#if user?has_content&&(a.adminIds)?has_content&&a.adminIds?seq_contains(user.id)>
                            <@cms.placeList path=path advanced=true pageIndex=pageNum pageSize=numPerPage>
                                <#list page.list as a>
                                    <@t.merge 'userIds' a.userId!/>
                                </#list>
                                <@sys.user ids=t.userIds!><#assign userMap=map!/></@sys.user>
                                <#list page.list as a>
                                        <p>
                                            <a href="${a.url}" target="_blank">${a.title}</a> ${a.clicks} [${(userMap[a.userId?string].nickname)!}]
                                    <#if 2=a.status>
                                        <a href="${site.dynamicPath}place/check?id=${a.id}&returnUrl=${site.dynamicPath}member/friendlink.html&_csrf=<@tools.csrfToken/>">审核</a>
                                    <#elseif 1=a.status>
                                        <a href="${site.dynamicPath}place/uncheck?id=${a.id}&returnUrl=${site.dynamicPath}member/friendlink.html&_csrf=<@tools.csrfToken/>">取消审核</a>
                                    </#if>
                                            <a href="${site.dynamicPath}place/delete?id=${a.id}&returnUrl=${site.dynamicPath}member/friendlink.html&_csrf=<@tools.csrfToken/>">删除</a>
                                        </p>
                                </#list>
                            </@cms.placeList>
                        </#if>
                    </div>
                </div>
            </div>
        </div>
		<script>
		var templatePath='${.current_template_name?keep_after('/')}';
		</script>
        <@tools.includePlace path="/footer/7f8bacb5-30ca-4641-b66f-987d447b1a85.html"/> <#-- footer -->
        <script type="text/javascript">
            $(function(){$('.login-form input').eq(0).focus();});
            function check(){
                if(!$('input[name=title]').val()||!$('input[name=url]').val()){
                    alert('站点标题和地址不能为空');
                    return false;
                }
                return true;
            }
        </script>
    </body>
</html>
